<style>
	.page{
		padding-bottom: 0;
		background: #ffffff;
	}
	
	.m-header{
		position: relative;
		width: 100%;
		height: 574upx;
		overflow: hidden;
		z-index: 1;
		display: inline-block;
	}
	.header-bg{
		width: 100%;
		height: 574upx;
		position: absolute;
		top: 0;
		left: 0;
		z-index: -1;
	}
	.header-bg image{
		width: 100%;
		height: 100%;
	}
	.header-title{
		font-size: 32upx;
		color: #ffffff;
		text-align: center;
		width: 100%;
	}
	.header-number{
		font-size: 56upx;
		color: #ffffff;
		width: 100%;
		text-align: center;
	}
	
	.zbDetail{
		color: #FFFFFF;
		font-size: 32upx;
		position: absolute;
		top: 5upx;
		right: 10upx;
	}
	
	.m-agent{
		padding-bottom: 40rpx;
		display: flex;
		justify-content: center;
	}
	.m-agent .item{
		flex: 1;
		position: relative;
		text-align: center;
	}
	.m-agent .item image{
		width: 94rpx;
		height: 94rpx;
		display: block;
		margin: 0 auto;
	}
	.m-agent .num{
		font-size: 36rpx;
		color: #2c2c2c;
		margin-top: 8rpx;
	}
	.m-agent .text{
		font-size: 28rpx;
		color: #9b9b9b;
		text-align: center;
	}
	
	.type-icon{
		padding-top: 120rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #FFFFFF;
		font-size: 32rpx;
	}
	.type-icon image{
		width: 46rpx;
		height: 42rpx;
		display: block;
		margin-right: 10rpx;
	}
	.btns{
		position: fixed;
		bottom: 18rpx;
		left: 0;
		width: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #FFFFFF;
		padding-top: 20rpx;
		z-index: 9;
	}
	.btns .btn{
		width: 356rpx;
		height: 88rpx;
		color: #FFFFFF;
		font-size: 34rpx;
		text-align: center;
		line-height: 88rpx;
		border-radius: 10rpx;
		margin: 0 5rpx;
	}
	.btns .orderList{
		background-image: linear-gradient(to bottom, #f33030 , #f97878);
	}
	.btns .saveList{
		background-image: linear-gradient(to bottom, #fa5c2b , #ff976e);
	}
	.m-full-loading{
		background-color: transparent;
		z-index: 13;
	}
</style>

<template>
	<view class="page">
		<view class="m-header">
			<view class="type-icon"><image :src="data.filename"></image>{{data.type_name||''}}</view>
			<view class="header-title">享宝金额</view>
			<view class="header-number">{{data.all_money||0}}</view>
			<view class="header-bg"><image src="../../../static/images/maker_bg.png"></image></view>
			<!-- #ifdef MP-WEIXIN -->
			<view class="zbDetail" @tap="zbDetail">明细</view>
			<!-- #endif -->
		</view>
		<view class="m-agent">
			<view @tap="goUrl('/pages/jewel/agent_jewel/allowance_list')" class="item">
				<image class="img" src="../../../static/icons/agent_jewel/agent_i4.png"></image>
				<view class="num">{{data.deal_money||0}}</view>
				<view class="text">代言得米</view>
			</view>
			<view @tap="goUrl('/pages/jewel/agent_jewel/hl_takecash?state=5')" class="item">
				<image src="../../../static/icons/agent_jewel/agent_i2.png"></image>
				<view class="num">{{data.keep_money_income||0}}</view>
				<view class="text">寄存津贴</view>
			</view>
			<view @tap="goUrl('/pages/jewel/agent_jewel/hl_takecash?state=4')" class="item">
				<image src="../../../static/icons/agent_jewel/agent_i3.png"></image>
				<view class="num">{{data.income_money||0}}</view>
				<view class="text">保养津贴</view>
			</view>
		</view>
		
		<view class="btns">
			<navigator open-type="navigate" url="/pages/jewel/order/orderlist" class="btn orderList" hover-class="none">订单列表</navigator>
			<navigator open-type="navigate" url="/pages/jewel/agent_jewel/keeplist" class="btn saveList" hover-class="none">寄存列表</navigator>
		</view>
		<view class="m-full-loading" v-if="showLoading">
		    <view class="m-loading">
		        <image src="../../../static/images/loading.gif"></image>
		    </view>
		</view>
	</view>
</template>
<script>
	import henglang from '@/common/common_zb.js';
	export default {
		data() {
			return {
                showPopup: false,
				showLoading: false,
				data: [],
				maker_num:0,
				takeList:[],
				historyList:[],
				errorMsg:''
			};
		},
        methods: {
			togglePopup() {
			    this.showPopup = !this.showPopup;
			},
			makeCall(){
				uni.makePhoneCall({
					phoneNumber:'4008-338-381'
				})
			},
			zbDetail(){
				uni.navigateTo({
					url:'/pages/jewel/order/bill?type=1'
				})
			},
			transform(){
				uni.navigateTo({
					url:'/pages/jewel/agent_jewel/transform'
				})
			},
			goUrl(url){
				if(this.maker_num > 0){
					uni.navigateTo({
						url:url
					})
				}
			},
			getData(){
				let that = this
				that.showLoading = true;
				henglang.get('agent_jewel/getInfo',{},true,function(res){
					that.showLoading = false;
					if(res.data.code == 0){
						that.data = res.data.data
						that.maker_num = that.data.type
						uni.setNavigationBarTitle({
							title:that.data.type_text?that.data.type_text:'推广代言'
						})
					}else{
						henglang.showToast(res.data.msg)
						that.errorMsg = res.data.msg
					}
					// #ifdef APP-PLUS
					if(that.data.show_yeji == 0 || !that.data.show_yeji){
						var webView = that.$mp.page.$getAppWebview();
						// 修改buttons  
						// index: 按钮索引, style {WebviewTitleNViewButtonStyles }  
						webView.setTitleNViewButtonStyle(0, {  
						    text: '',  
						});  
					}
					// #endif
				});
				
			}
        },
        onLoad() {
			this.getData()
			
        },
		onNavigationBarButtonTap(e) {
		    if (e.index == 0) {
				if(this.data.show_yeji == 0 || !this.data.show_yeji){
					return false
				} 
				if(this.maker_num > 0){
					uni.navigateTo({
						url:'/pages/jewel/agent_jewel/level_center'
					})
				}else{
					henglang.showToast(this.errorMsg)
				}
		    }
		},
		onPullDownRefresh (){
			this.getData();
			uni.stopPullDownRefresh();
		}
	}
</script>

